@model EditReviewViewModel

@{
	ViewBag.Title = Resources.Shared.AppName + " - " + string.Format(Resources.Shared.EditViewTitle, Model.IdentityDescription);
	string twoLettersCulture = new System.Globalization.CultureInfo(Culture).TwoLetterISOLanguageName;	
}

<div class="view-container">
  <div class="view-header-container">
    <h2 class="view-header">@string.Format(Resources.Shared.EditViewTitle, Model.IdentityDescription)</h2>
  </div>
  <!-- Top buttons -->
  <div class="view-button-container top-button-container">
    <input type="button" class="button back-button" title="@Resources.Shared.Back" onclick="document.location = '@Url.Action("Index","Review")'"/>
    <input type="button" class="button save-button" title="@Resources.Shared.Save" onclick="$('#ReviewForm').submit()"/>	
  </div>
  <!-- Form begin -->
  <div class="entity-form-container">
    @using (Html.BeginForm("Edit", "Review", FormMethod.Post, new { id = "ReviewForm" })) {
      @Html.ValidationSummary(true)
      <fieldset>
        <legend>@Resources.ReviewResources.Review</legend>
		<div class="form">
          @Html.HiddenFor(model => model.Id)
				<div class="field">
				  <div class="label">
					@Html.Label(Resources.ReviewResources.Date)
			  	  </div>
				  <div class="editor date-editor">
					@Html.TextBoxFor(model => model.Date)
					@Html.ValidationMessageFor(model => model.Date)
				  </div>
				</div>
				<div class="field">
				  <div class="label">
					@Html.Label(Resources.ReviewResources.Rating)
			  	  </div>
				  <div class="editor number-editor">
					@Html.EditorFor(model => model.Rating, "Rating")
					@Html.ValidationMessageFor(model => model.Rating)
				  </div>
				</div>
				<div class="field">
				  <div class="label">
					@Html.Label(Resources.ReviewResources.Comment)
			  	  </div>
				  <div class="editor ">
					@Html.TextBoxFor(model => model.Comment)
					@Html.ValidationMessageFor(model => model.Comment)
				  </div>
				</div>
		    <div class="field">
              <div class="label">
                @Html.Label(Resources.ReviewResources.Customer)
              </div>
              <div class="editor">
                @Html.DropDownListFor(model => model.CustomerId, new SelectList(Model.CustomerList, "Id", "IdentityDescription", Model.CustomerId))           
                @Html.ValidationMessageFor(model => model.CustomerId)
              </div>
		    </div>
		    <div class="field">
              <div class="label">
                @Html.Label(Resources.ReviewResources.Product)
              </div>
              <div class="editor">
                @Html.DropDownListFor(model => model.ProductId, new SelectList(Model.ProductList, "Id", "IdentityDescription", Model.ProductId))           
                @Html.ValidationMessageFor(model => model.ProductId)
              </div>
		    </div>
        </div>
      </fieldset>
    }
    </div>
	<!-- Form end -->
 
</div>
@section Scripts {
	@Scripts.Render("~/bundles/jqueryval")
    <script src="@Url.Content("~/Scripts/cultures/methods_" + twoLettersCulture + ".js")" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
    $("#Date").datepicker({
        showOn: "button",
        buttonImage: "@Url.Content("~/Content/Images/calendar.png")",
        buttonImageOnly: true,
		changeMonth: true,
		changeYear: true
    });

	$("#Date").datepicker("option",
		$.datepicker.regional["@(twoLettersCulture == "en" ? "" : twoLettersCulture)"]);
	$("#Date").val('@(Model.Date != DateTime.MinValue ? Model.Date.ToShortDateString() : "")');
});
</script>
}
